import sys

QX = input("是否开始（YES/NO）:")

while QX == "YES":
    while True:
        try:

            input_str = input("输入身高(cM) 输入体重(KG) 输入年龄(age) ")
            list = input_str.split(' ')
            height = int(list[0])
            weight = int(list[1])
            age = int(list[2])
            xinbie = input("输入性别")

            if xinbie == "男":
                bmr = 10 * weight + 6.25 * height - 5 * age + 5
                print("基础代谢率：", bmr)
                QX = input("是否继续（YES/NO）:")
                break
            if xinbie == "女":
                bmr = 10 * weight + 6.25 * height - 5 * age - 161
                print("基础代谢率(大卡)：", bmr)
                QX = input("是否继续（YES/NO）:")
                break

        except ValueError:
            print("出错")

while QX == "NO":
    sys.exit()
else:
    print("无效")
    sys.exit()
